package cn.xiaopengstack.domain.activity.service.trialcal.factory;

import cn.xiaopengstack.domain.activity.model.entity.MarketProductEntity;
import cn.xiaopengstack.domain.activity.model.entity.TrialCalculateEntity;
import cn.xiaopengstack.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import cn.xiaopengstack.domain.activity.model.valobj.SkuVO;
import cn.xiaopengstack.domain.activity.service.trialcal.node.RootNode;
import cn.xiaopengstack.types.framework.strategy.tree.StrategyHandler;
import lombok.Data;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author jiangyangang
 */
@Component
public class DefaultActivityStrategyFactory {

    @Resource
    private RootNode rootNode;

    public StrategyHandler<MarketProductEntity, DynamicContext, TrialCalculateEntity> strategyHandler() throws Exception  {
        return rootNode;
    }

    @Data
    public static class DynamicContext{

        /**
         * 活动折扣信息
         */
        private GroupBuyActivityDiscountVO groupBuyActivityDiscountVO;

        /**
         * SKU信息
         */
        private SkuVO skuVO;

        /**
         * 扣减金额
         */
        private BigDecimal deductionPrice;

        /**
         * 实际支付价格
         */
        private BigDecimal payPrice;

        /**
         * 是否可见
         */
        private boolean isVisible;

        /**
         * 是否可用
         */
        private boolean isEnable;
    }
}
